menu "Kernel hacking"

source "lib/Kconfig.debug"

config STRICT_DEVMEM
	bool "Filter access to /dev/mem"
	depends on MMU
	---help---
	  If this option is disabled, you allow userspace (root) access to all
	  of memory, including kernel and userspace memory. Accidental
	  access to this is obviously disastrous, but specific access can
	  be used by people debugging the kernel.

	  If this option is switched on, the /dev/mem file only allows
	  userspace access to memory mapped peripherals.

          If in doubt, say Y.

# RMK wants arm kernels compiled with frame pointers or stack unwinding.
# If you know what you are doing and are willing to live without stack
# traces, you can get a slightly smaller kernel by setting this option to
# n, but then RMK will have to kill you ;).
config FRAME_POINTER
	bool
	depends on !THUMB2_KERNEL
	default y if !ARM_UNWIND || FUNCTION_GRAPH_TRACER
	help
	  If you say N here, the resulting kernel will be slightly smaller and
	  faster. However, if neither FRAME_POINTER nor ARM_UNWIND are enabled,
	  when a problem occurs with the kernel, the information that is
	  reported is severely limited.

config ARM_UNWIND
	bool "Enable stack unwinding support (EXPERIMENTAL)"
	depends on AEABI && EXPERIMENTAL
	default y
	help
	  This option enables stack unwinding support in the kernel
	  using the information automatically generated by the
	  compiler. The resulting kernel image is slightly bigger but
	  the performance is not affected. Currently, this feature
	  only works with EABI compilers. If unsure say Y.

config OLD_MCOUNT
	bool
	depends on FUNCTION_TRACER && FRAME_POINTER
	default y

config DEBUG_USER
	bool "Verbose user fault messages"
	help
	  When a user program crashes due to an exception, the kernel can
	  print a brief message explaining what the problem was. This is
	  sometimes helpful for debugging but serves no purpose on a
	  production system. Most people should say N here.

	  In addition, you need to pass user_debug=N on the kernel command
	  line to enable this feature.  N consists of the sum of:

	      1 - undefined instruction events
	      2 - system calls
	      4 - invalid data aborts
	      8 - SIGSEGV faults
	     16 - SIGBUS faults

config FORCE_PAGES
	bool "Force lowmem to be mapped with 4K pages"
        help
          There are some advanced debug features that can only be done when
          memory is mapped with pages instead of sections. Enable this option
          to always map lowmem pages with pages. This may have a performance
          cost due to increased TLB pressure.

          If unsure say N.

config FREE_PAGES_RDONLY
	bool "Set pages as read only while on the buddy list"
	select FORCE_PAGES
	select PAGE_POISONING
	help
          Pages are always mapped in the kernel. This means that anyone
          can write to the page if they have the address. Enable this option
          to mark pages as read only to trigger a fault if any code attempts
          to write to a page on the buddy list. This may have a performance
          impact.

          If unsure, say N.

# These options are only for real kernel hackers who want to get their hands dirty.
config DEBUG_LL
	bool "Kernel low-level debugging functions (read help!)"
	depends on DEBUG_KERNEL
	help
	  Say Y here to include definitions of printascii, printch, printhex
	  in the kernel.  This is helpful if you are debugging code that
	  executes before the console is initialized.

	  Note that selecting this option will limit the kernel to a single
	  UART definition, as specified below. Attempting to boot the kernel
	  image on a different platform *will not work*, so this option should
	  not be enabled for kernels that are intended to be portable.

choice
	prompt "Kernel low-level debugging port"
	depends on DEBUG_LL

	config AT91_DEBUG_LL_DBGU0
		bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl"
		depends on HAVE_AT91_DBGU0

	config AT91_DEBUG_LL_DBGU1
		bool "Kernel low-level debugging on 9263 and 9g45"
		depends on HAVE_AT91_DBGU1

	config DEBUG_CLPS711X_UART1
		bool "Kernel low-level debugging messages via UART1"
		depends on ARCH_CLPS711X
		help
		  Say Y here if you want the debug print routines to direct
		  their output to the first serial port on these devices.

	config DEBUG_CLPS711X_UART2
		bool "Kernel low-level debugging messages via UART2"
		depends on ARCH_CLPS711X
		help
		  Say Y here if you want the debug print routines to direct
		  their output to the second serial port on these devices.

	config DEBUG_DC21285_PORT
		bool "Kernel low-level debugging messages via footbridge serial port"
		depends on FOOTBRIDGE
		help
		  Say Y here if you want the debug print routines to direct
		  their output to the serial port in the DC21285 (Footbridge).

	config DEBUG_FOOTBRIDGE_COM1
		bool "Kernel low-level debugging messages via footbridge 8250 at PCI COM1"
		depends on FOOTBRIDGE
		help
		  Say Y here if you want the debug print routines to direct
		  their output to the 8250 at PCI COM1.

	config DEBUG_HIGHBANK_UART
		bool "Kernel low-level debugging messages via Highbank UART"
		depends on ARCH_HIGHBANK
		help
		  Say Y here if you want the debug print routines to direct
		  their output to the UART on Highbank based devices.

	config DEBUG_IMX1_UART
		bool "i.MX1 Debug UART"
		depends on SOC_IMX1
		help
		  Say Y here if you want kernel low-level debugging support
		  on i.MX1.

	config DEBUG_IMX23_UART
		bool "i.MX23 Debug UART"
		depends on SOC_IMX23
		help
		  Say Y here if you want kernel low-level debugging support
		  on i.MX23.

	config DEBUG_IMX25_UART
		bool "i.MX25 Debug UART"
		depends on SOC_IMX25
		help
		  Say Y here if you want kernel low-level debugging support
		  on i.MX25.

	config DEBUG_IMX21_IMX27_UART
		bool "i.MX21 and i.MX27 Debug UART"
		depends on SOC_IMX21 || SOC_IMX27
		help
		  Say Y here if you want kernel low-level debugging support
		  on i.MX21 or i.MX27.

	config DEBUG_IMX28_UART
		bool "i.MX28 Debug UART"
		depends on SOC_IMX28
		help
		  Say Y here if you want kernel low-level debugging support
		  on i.MX28.

	config DEBUG_IMX31_IMX35_UART
		bool "i.MX31 and i.MX35 Debug UART"
		depends on SOC_IMX31 || SOC_IMX35
		help
		  Say Y here if you want kernel low-level debugging support
		  on i.MX31 or i.MX35.

	config DEBUG_IMX51_UART
		bool "i.MX51 Debug UART"
		depends on SOC_IMX51
		help
		  Say Y here if you want kernel low-level debugging support
		  on i.MX51.

	config DEBUG_IMX50_IMX53_UART
		bool "i.MX50 and i.MX53 Debug UART"
		depends on SOC_IMX50 || SOC_IMX53
		help
		  Say Y here if you want kernel low-level debugging support
		  on i.MX50 or i.MX53.

	config DEBUG_IMX6Q_UART4
		bool "i.MX6Q Debug UART4"
		depends on SOC_IMX6Q
		help
		  Say Y here if you want kernel low-level debugging support
		  on i.MX6Q UART4.

	config DEBUG_REALVIEW_STD_PORT
		bool "RealView Default UART"
		depends on ARCH_REALVIEW
		help
		  Say Y here if you want the debug print routines to direct
		  their output to the serial port on RealView EB, PB11MP, PBA8
		  and PBX platforms.

	config DEBUG_REALVIEW_PB1176_PORT
		bool "RealView PB1176 UART"
		depends on MACH_REALVIEW_PB1176
		help
		  Say Y here if you want the debug print routines to direct
		  their output to the standard serial port on the RealView
		  PB1176 platform.

	config DEBUG_S3C_UART0
		depends on PLAT_SAMSUNG
		bool "Use S3C UART 0 for low-level debug"
		help
		  Say Y here if you want the debug print routines to direct
		  their output to UART 0. The port must have been initialised
		  by the boot-loader before use.

		  The uncompressor code port configuration is now handled
		  by CONFIG_S3C_LOWLEVEL_UART_PORT.

	config DEBUG_S3C_UART1
		depends on PLAT_SAMSUNG
		bool "Use S3C UART 1 for low-level debug"
		help
		  Say Y here if you want the debug print routines to direct
		  their output to UART 1. The port must have been initialised
		  by the boot-loader before use.

		  The uncompressor code port configuration is now handled
		  by CONFIG_S3C_LOWLEVEL_UART_PORT.

	config DEBUG_S3C_UART2
		depends on PLAT_SAMSUNG
		bool "Use S3C UART 2 for low-level debug"
		help
		  Say Y here if you want the debug print routines to direct
		  their output to UART 2. The port must have been initialised
		  by the boot-loader before use.

		  The uncompressor code port configuration is now handled
		  by CONFIG_S3C_LOWLEVEL_UART_PORT.

	config DEBUG_LL_UART_NONE
		bool "No low-level debugging UART"
		help
		  Say Y here if your platform doesn't provide a UART option
		  below. This relies on your platform choosing the right UART
		  definition internally in order for low-level debugging to
		  work.

	config DEBUG_ICEDCC
		bool "Kernel low-level debugging via EmbeddedICE DCC channel"
		help
		  Say Y here if you want the debug print routines to direct
		  their output to the EmbeddedICE macrocell's DCC channel using
		  co-processor 14. This is known to work on the ARM9 style ICE
		  channel and on the XScale with the PEEDI.

		  Note that the system will appear to hang during boot if there
		  is nothing connected to read from the DCC.

	config DEBUG_SEMIHOSTING
		bool "Kernel low-level debug output via semihosting I"
		help
		  Semihosting enables code running on an ARM target to use
		  the I/O facilities on a host debugger/emulator through a
		  simple SVC calls. The host debugger or emulator must have
		  semihosting enabled for the special svc call to be trapped
		  otherwise the kernel will crash.

		  This is known to work with OpenOCD, as wellas
		  ARM's Fast Models, or any other controlling environment
		  that implements semihosting.

		  For more details about semihosting, please see
		  chapter 8 of DUI0203I_rvct_developer_guide.pdf from ARM Ltd.

endchoice

config EARLY_PRINTK
	bool "Early printk"
	depends on DEBUG_LL
	help
	  Say Y here if you want to have an early console using the
	  kernel low-level debugging functions. Add earlyprintk to your
	  kernel parameters to enable this console.

config OC_ETM
	bool "On-chip ETM and ETB"
	depends on ARM_AMBA
	help
	  Enables the on-chip embedded trace macrocell and embedded trace
	  buffer driver that will allow you to collect traces of the
	  kernel code.

config ARM_KPROBES_TEST
	tristate "Kprobes test module"
	depends on KPROBES && MODULES
	help
	  Perform tests of kprobes API and instruction set simulation.

comment "Samsung Debugging Feature"
menuconfig SEC_DEBUG
	bool "Samsung TN Ramdump Feature"
	default n
	help
	  Samsung TN Ramdump Feature.
	  Enables collection of ram dump.
	  Enables task history, debug level etc.
	  This feature is enabled in defconfig.
if SEC_DEBUG
config SEC_DEBUG_SCHED_LOG
	bool "Samsung Scheduler Logging Feature"
	default n
	help
	  Samsung Scheduler Logging Feature for Debug use.
	  Enables task scheduling history.
	  Enables IRQ scheduling history.
	  This feature is enabled in defconfig.
config SEC_DEBUG_SEMAPHORE_LOG
	bool "Samsung Semaphore Logging Feature"
	default n
	help
	  Samsung Semaphore Logging Feature for Debug use.
	  Enables semaphore debugging statistics.
	  Enables logging.
	  This feature is enabled in defconfig.

config SEC_FILE_LEAK_DEBUG
	bool "Samsung File Leak Debugging Feature"
	default n
	help
	  Samsung File Leak Debugging Feature for Debug use.
	  Enables the forced panic mode when EMFILE Eror occurs.
	  This feature is enabled in defconfig.

config SEC_LOGGER_BUFFER_EXPANSION
	bool "Samsung Logger Buffer Expansion Feature"
	default n
	help
	  This is used to expand buffers of logger.
	  This feature is enabled in defconfig.

config SEC_LOGGER_BUFFER_EXPANSION_SIZE
	int "Samsung Logger Buffer Expansion Size(MB)"
	depends on SEC_LOGGER_BUFFER_EXPANSION
	default 2
	help
	  This is used to expand main buffer of logger(MB).

endif

config SEC_FORKHANG_DEBUG
	bool "Debug Feature for Newly Forked task getting HANg on mmap_sem down_read()"
	default n
	help
	  mmap_sem writer lock logging for ram dump analysis.
	  Collects kernel debug log.
	  Log is collected in the no-cache area.
	  This feature is enabled in defconfig.

config SEC_DEBUG_USER
	bool "Panic on Userspace fault"
	default y
	help
	  Panic on Userspace fault
	  This feature enables collection of ram dump,
	  on user fault.
	  Enabled native code debugging.
config SEC_DEBUG_IRQ_EXIT_LOG
	bool "Temporary Logging for IRQ delay"
	default n
	help
	  Verbose Logging for IRQ delay.
	  Helps indetification of irq enter and exit.
	  This is to track the current state of IRQ execution.
	  This is enabled in defconfig file.
config SEC_DEBUG_MSG_LOG
	bool "Message Log for ram dump debug"
	default n
	help
	  Verbose Logging for ram dump analysis.
	  Collects kernel debug log.
	  Log is collected in the no-cache area.
	  This feature is enabled in defconfig.
config SEC_DEBUG_SUBSYS
	bool "Debug subsystems"
	default n
	help
	  Subsystems debug feature.
	  When enabled provides kernel logs, modem logs, RPM registers,
	  Schedule and IRQ logs at the time of crash along with the
	  reason for crash, which can be extracted as a html in RAM dump mode.
config SEC_DEBUG_DCVS_LOG
	bool "Temporary Logging for DCVS"
	default n
	help
	  DCVS Logging Feature for Debug use.
	  The ACPU clock rate changes will be logged as a part
	  of secdbg_log structure along with the CPU time stamp.
	  The previous frequency and the new frequency for both the CPU along
	  with the CPU time stamp will be logged.
config SEC_DEBUG_FUELGAUGE_LOG
	bool "Temporary Logging for FuelGauge"
	default n
	help
	 FuelGauge Logging Feature for Debug use.
	 The FuelGauge values are logged as a part
	 of secdbg_log structure along with the CPU time stamp.
	 The voltage and soc values along with the CPU time will be logged.
config SEC_DEBUG_LOW_LOG
	bool "Kernel Message Logging for Debug Level Low"
	default n
	help
	 Kernel Message Logging Feature for Debug use.
	 The Kernel Messages are logged using file I/O
	 when an exception occurs, when the debug level is low.
	 The file I/O is added in kernel driver level
	 so that kernel messages are logged on next reboot.
config SEC_DEBUG_MDM_FILE_INFO
	bool "MDM filename and line number in UPLOAD mode"
	default n
	help
	 This feature enables display of MDM info in upload mode.
	 This feature enabled SSR in debug level low.
	 Collects MDM ram dump and then calls panic.
	 UPLOAD mode has MDM dump info to show it on LCD.
config SEC_DEBUG_DOUBLE_FREE
	bool "Enable double free detection"
	default n
	help
	 Detect erraneous codes that frees a kmalloced node
	 twice. When kfree(p) is called, p is not freed right away.
	 Instead, it is pushed into a circular buffer. What it frees
	 is the oldest pointer that was pushed into the buffer.
	 If someone tries to free the same pointer p, *p
	 is read and checked for a magic code that is written
	 when it was first freed. If it matches, the whole
	 circular buffer is searched. Panic is be called when
	 the match is found.

config SEC_LOG_LAST_KMSG
	bool "Enable /proc/last_kmsg support: if EMBEDDED"
	default n
	help
	  This option enables /proc/last_kmsg support.
config SEC_DEBUG_NOCACHE_LOG_IN_LEVEL_LOW
	bool "Enable nocache logging in debug level LOW"
	default n
	help
	  Enable nocache logging in debug level LOW.

config SEC_MONITOR_BATTERY_REMOVAL
	bool "Enable monitering whether normal power sequence or not"
	default n
	help
	  Enable monitering Power off & battery removal.

comment "PowerManagement Feature"
menuconfig SEC_PM
	bool "Samsung TN PowerManagement Feature"
	default y
	help
	  Samsung TN PowerManagement Feature.

if SEC_PM
config SEC_PM_DEBUG
	bool "Samsung TN PowerManagement Debug Feature"
	default n
	help
	  Samsung TN PowerManagement Debug Feature.

endif

config PID_IN_CONTEXTIDR
	bool "Write the current PID to the CONTEXTIDR register"
	depends on CPU_COPY_V6
	help
	  Enabling this option causes the kernel to write the current PID to
	  the PROCID field of the CONTEXTIDR register, at the expense of some
	  additional instructions during context switch. Say Y here only if you
	  are planning to use hardware trace tools with this kernel.

config DEBUG_SET_MODULE_RONX
	bool "Set loadable kernel module data as NX and text as RO"
	depends on MODULES
	---help---
	  This option helps catch unintended modifications to loadable
	  kernel module's text and read-only data. It also prevents execution
	  of module data. Such protection may interfere with run-time code
	  patching and dynamic kernel tracing - and they might also protect
	  against certain classes of kernel exploits.
	  If in doubt, say "N".

comment "Samsung Rooting Restriction Feature"
config SEC_RESTRICT_ROOTING
	bool "Samsung Rooting Restriction Feature"
	default n
	help
	  Restrict unauthorized executions with root permission.

config SEC_RESTRICT_SETUID
	bool "Restrict changing root privilege except allowed process"
	depends on SEC_RESTRICT_ROOTING
	default y
	help
	  Say Y here if you want to restrict functions related setuid. Only allowed
	  process can chanage ROOT privilege. Saying N will not restrict changing
	  permission.

config SEC_RESTRICT_FORK
	bool "Restrict forking process except allowed process"
	depends on SEC_RESTRICT_ROOTING
	default y
	help
	  Say Y here if you want to restrict function related fork. Process matched
	  special condition will be not forked. Saying N will not restrict forking
	  process.

config SEC_RESTRICT_ROOTING_LOG
	bool "Print restricted result to kernel log"
	depends on SEC_RESTRICT_ROOTING
	default n
	help
	   Say Y here if you want to see result of restricting SETUID or FORK. It will
	   be displayed by kernel error log. Saying N will not be displayed anything.


config RESTART_REASON_SEC_PARAM
	bool "Save restart reason in SEC param partition"
	default n
	help
	  Param partition can retain the values across reboot, hence this comes in handy backup, when restart reason saved in IMEM is lost.

config RESTART_REASON_DDR
	bool "Save restart reason in DDR reserved area"
	default n
	help
	  This comes in handy backup, when restart reason saved in IMEM is lost.

comment "BSP Feature"
menuconfig SEC_BSP
	bool "Samsung TN BSP Feature"
	default n
	help
	  Samsung TN BSP Feature.

endmenu
